from django.urls import path
# from rest_framework_jwt.views import obtain_jwt_token

from rest_framework.routers import DefaultRouter

from apps.meiduo_admin.login import admin_jwt_token
from apps.meiduo_admin.view import image
from apps.meiduo_admin.view.count_views import UserDailyActiveCountView, UserDailyOrderCountView, UserMonthCountView, UserDayCountView
from apps.meiduo_admin.view.image import SKUImageView
from apps.meiduo_admin.view.sku_view import SKUModelViewSet, SKUCategoriesView, GoodsSimpleView, GoodsSpecView

from apps.meiduo_admin.view.user_view import UserListView
urlpatterns = [
    path('authorizations/', admin_jwt_token),
    path('statistical/day_active/', UserDailyActiveCountView.as_view()),
    path('statistical/day_orders/', UserDailyOrderCountView.as_view()),
    path('statistical/month_increment/', UserMonthCountView.as_view()),
    path('statistical/day_increment/', UserDayCountView.as_view()),

    path('users/', UserListView.as_view()),
    path('skus/simple/', image.SKUView.as_view()),

    path('skus/categories/', SKUCategoriesView.as_view()),

    path('goods/simple/', GoodsSimpleView.as_view()),

    path('goods/<int:pk>/specs/', GoodsSpecView.as_view()),

]

#创建router实例
router = DefaultRouter()

#注册路由
router.register(r'skus/images', SKUImageView, basename='image')
router.register(r'skus', SKUModelViewSet, basename='sku')


#将router生成的路由追加到urlpatterns中
urlpatterns += router.urls



